<?php use_helper('PA_Links') ?>
<?php if(isset($form) && !isset($form['no_items'])): ?>
<?php echo $form->renderFormTag(link_to_app('Production', 'createDemand'), array('id' => 'demandForm')) ?>
<?php echo $form->renderHiddenFields() ?>
<table id="productionDemandTable" style="display: inline-table">
  <tr>
    <th><?php echo $form['project_id']->renderLabel() ?></th>
    <td colspan="3"><?php echo $form['project_id']->render() ?></td>
  </tr>
  <tr>
    <th>Opis</th>
    <td colspan="3"><?php echo $form['description']->render() ?></td>
  </tr>
  <tr>
    <th>Lp</th>
    <th style="min-width: 250px;">Materiał</th>
    <th>Ilość [<?php if(isset($quantityUnit)) echo $quantityUnit ?>]</th>
    <th><img src="/images/icons/add.png" width="16" height="16" class="middle" onclick="App.Table.addDemandRow(this, false)" /></th>
  </tr>
  <tr id="item_1">
    <td><p id="counter"/></td>
    <td><?php echo $form['items_list']->render() ?></td>
    <td><?php echo $form['items_list_values']->render(array('size' => '8')) ?></td>
    <td></td>
  </tr>
  <tr>
    <td colspan="4">
      <input type="button" value="Zapisz" onclick="if(App.Form.validateLength('input[id*=items_list_values]', 2)) App.Form.validateMultiSelects('demandForm', function(){App.Form.submit('demandForm', true)})" />
    </td>
  </tr>
</table
<?php elseif(isset($error)): ?>
  <?php echo $error ?>
<?php else: ?>
  Brak pozycji w magazynie.
<?php endif; ?>